package com.teradata.olingo.metadata.core.edm.mapper.api;


import com.teradata.olingo.metadata.core.edm.mapper.exception.ODataGenericModelException;

import java.util.List;

/**
 * External view on an Intermediate Structured Type.
 *
 * @author Oliver Grande
 *
 */
public interface GenericStructuredType extends GenericElement {
  public GenericAssociationAttribute getAssociation(String internalName) throws ODataGenericModelException;

  public GenericAssociationPath getAssociationPath(String externalName) throws ODataGenericModelException;

  /**
   * Searches in the navigation properties that are available for this type via the OData service. That is:
   * <ul>
   * <li> All not ignored navigation properties of this type.
   * <li> All not ignored navigation properties from supertypes are included
   * <li> All not ignored navigation properties from embedded types are included.
   * </ul>
   * @return null if no navigation property found.
   * @throws ODataGenericModelException
   */
  public List<GenericAssociationPath> getAssociationPathList() throws ODataGenericModelException;

  public GenericAttribute getAttribute(String internalName) throws ODataGenericModelException;

  public List<GenericAttribute> getAttributes() throws ODataGenericModelException;

  /**
   * In case the type is within the given association path, the sub-path is returned.
   * E.g. structured type is AdministrativeInformation and associationPath = AdministrativeInformation/Created/User
   * Created/User is returned.
   * @param associationPath
   * @return
   * @throws ODataGenericModelException
   */
  public GenericAssociationPath getDeclaredAssociation(GenericAssociationPath associationPath) throws ODataGenericModelException;

  public GenericAssociationPath getDeclaredAssociation(String externalName) throws ODataGenericModelException;

  /**
   * List of all associations that are declared at this type. That is:
   * <ul>
   * <li> All not ignored navigation properties of this type.
   * <li> All not ignored navigation properties from supertypes are included
   * </ul>
   * @return
   * @throws ODataGenericModelException
   */
  public List<GenericAssociationAttribute> getDeclaredAssociations() throws ODataGenericModelException;

  public GenericPath getPath(String externalName) throws ODataGenericModelException;

  /**
   * List of all attributes that are available for this type via the OData service. That is:
   * <ul>
   * <li> All not ignored properties of the type.
   * <li> All not ignored properties from supertypes.
   * <li> All not ignored properties from embedded types.
   * </ul>
   * @return List of all attributes that are available via the OData service.
   * @throws ODataGenericModelException
   */
  public List<GenericPath> getPathList() throws ODataGenericModelException;

  public Class<?> getTypeClass();

  public boolean isAbstract();

}
